package org.leumasjaffe.initiativeTracker.entity;

public enum Status {
	BLINDED("Blinded"),
	DAZED("Dazed"),
	DEAFENED("Deafened"),
	DOMINATED("Dominated"),
	IMMOBILIZED("Immobilized"),
	PETRIFIED("Petrified"),
	PRONE("Prone"),
	RESTRAINED("Restrained"),
	SLOWED("Slowed"),
	STUNNED("Stunned"),
	UNCONSCIOUS("Unconscious"),
	WEAKENED("Weakened"),
	MARKED("Marked"),
	CURSED("Cursed"),
	BLEED("Ongoing");
	
	public static final Status[] allStatus = {BLINDED, DAZED, DEAFENED, DOMINATED, IMMOBILIZED, 
		PETRIFIED, PRONE, RESTRAINED, SLOWED, STUNNED,
		UNCONSCIOUS, WEAKENED, MARKED, CURSED, BLEED};
	
	private String name;
	
	private Status(String name) {
		this.name = name;
	}
	
	public String getName() {
		return this.name;
	}
	
	@Override
	public String toString() {
		return this.name;
	}
	
	/**
	 * Determines the meaning of a given status effect
	 * @param index The index of the status effect
	 * @param name The name of the character
	 * @param dot The amount of damage over time the character is taking
	 * @return Returns a String describing the consequences of that status
	 */
	public static String meaning(int index, int dot) {
		return allStatus[index].meaning(dot);
	}
	
	private static final String ca = "grants combat advantage";
	private static final String cf = "cannot flank an enemy";
	
	/**
	 * Determines the meaning of a given status effect
	 * @param name The name of the character
	 * @param dot The amount of damage over time the character is taking
	 * @return Returns a String describing the consequences of that status
	 */
	public String meaning(int dot) {
		switch(this) {
		case BLINDED:
			return " and cannot see, targets have total concealment. It " + ca + ", " + cf +
			",\n   and takes a -10 penalty to Perception checks made to see.";
		case DAZED:
			return " and can only take a standard, move or minor action this turn (They" +
					" may also take free actions).\n    They" +
					" cannot take immediate or opportunity actions. " +
			this.name + " " + ca + " and " + cf + ".";
		case DEAFENED:
			return " and cannot hear anything. It takes a -10 penalty to Perception" + 
			" checks made to listen or hear.";
		case DOMINATED:
			return ", and is Dazed" + " and can only take a standard," +
					" move or minor action this turn (" +
			" It may also take free actions). It cannot take immediate or\n" +
			"    opportunity actions. " +
			this.name + " " + ca + " and " + cf + "." +
			"The dominating creature chooses your actions," +
			" but can only make you use at-will powers.";
		case IMMOBILIZED:
			return ", and cannot move from its space except by teleporting," +
					" or a forced push, pull or slide.";
		case PETRIFIED:
			return ". It has been turned to stone, cannot take any actions," +
					" gains resist 20 to all damage," + 
			" is unaware of its surroundings, and does not age.";
		case PRONE:
			return " and " + ca + " to all enemies making melee attacks." +
					" Gains a +2 bonus to defense against ranged" +
			" attacks from non-adjacent enemies,\n    but a -2 penalty to all attacks." +
			"It is lying on the ground.";
		case RESTRAINED:
			return " and " + ca + " and cannot move from its space except by teleporting. "  + 
			"It takes a -2 penalty to attack rolls.";
		case SLOWED:
			return ". Its speed is reduced to 2. This does not apply to a pull, push, or slide. " +
					"If your speed is lower than 2, it does not increase.";
		case STUNNED:
			return " and " + ca + ", " + cf + ", " + "and cannot take any actions." +
			" These effects also apply when you are surprised.";
		case UNCONSCIOUS:
			return " and has become helpless.\n    They " + ca + ", " + cf +
			", can be the target of a coup de grace," +
			"\n    takes a -5 penalty to all defenses, cannot take any action," +
			" and falls prone if possible.";
		case WEAKENED:
			return " and its attacks deal half damage. Ongoing damage is not effected.";
		case MARKED:
			return " and takes a -2 penalty to all attacks that do not include" +
					" the creature that marked it.";
		case CURSED:
			return ", it takes extra damage from the creature that cursed it." +
					" This effect also reffers to Hunter's Quarry.";
		case BLEED:
			return " has a bleed effect and will take " + dot + 
			" damage at the beginning of every turn.";
		}
			throw new RuntimeException("Invalid Checkbox");
	}
}
